import requests
import json
import xlrd
import xlwt
import openpyxl
from lxml import etree

'''
def geocodeB(address):
    """
    @ address: 名称字符串
    @ 返回值：经度，纬度
    """
    base_url = "http://api.map.baidu.com/place/v2/search?query=" + address + "&region=珠海&output=json&ak=uwdrLZeQgWir9SnDLQ4GzWyL3tpAU4vF"

    response = requests.get(base_url)
    print(response)
    answer = response.json()
    # print(type(answer))
    # print(answer['results'])
    # print(type(answer['results']))
    # print(answer['results'][0])
    # print(type(answer['results'][0]))
    # print(answer['results'][0]['location'])
    #
    # print(type(answer['results'][0]['location']))

    lat = answer['results'][0]['location']['lat']

    lng = answer['results'][0]['location']['lng']
    # dic_data=json.loads(answer)
    # print(dic_data)
    # print(ans['results'])
    # latitude = answer['results']['location']['lng']
    # print(latitude)
    # longitude = answer['results']['location']['lat']
    # print(longitude)
    # return 0
    return lat, lng
'''

# workbook=xlrd.open_workbook('C:/Users/Administrator/Desktop/1.xlsx')
# sheet1=workbook.sheet_by_index(0)
# cols=sheet1.col_values(0)
# print(cols)
# print(type(cols))
wb=openpyxl.load_workbook()
# ans_end=geocodeB('十字门华发商都')  # (117.094495, 36.205858)
# print(ans_end)
# print(type(ans_end))
